﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="clr-namespace:myManga.UI"
    xmlns:brightness="clr-namespace:MonitorControl;assembly=MonitorControl"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <!-- SimpleStyles: ComboBox -->
    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="23"/>
            </Grid.ColumnDefinitions>
            <Border Background="#0000"/>
            <Border
                Grid.Column="1"
                Margin="1" 
                Background="#000" 
                BorderBrush="#EEE"
                BorderThickness="1,0,0,0">
                <Path 
                    x:Name="Arrow"    
                    Fill="#777"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Data="M 0 0 L 6 6 L 12 0 Z"/>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="True">
                <Setter TargetName="Arrow" Property="Fill" Value="#AAA" />
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="True">
                <Setter TargetName="Arrow" Property="Fill" Value="#FFF" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="Arrow" Property="Fill" Value="#888888" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" TextElement.Foreground="White"/>
    </ControlTemplate>
    <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="18"/>
        <Setter Property="Background" Value="Black"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}" TextElement.Foreground="{TemplateBinding Foreground}" BorderThickness="1">
                        <Grid>
                            <ToggleButton 
                                Name="ToggleButton" 
                                Template="{StaticResource ComboBoxToggleButton}"
                                Focusable="False"
                                IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                                ClickMode="Press"/>
                            <ContentPresenter
                                Name="ContentSite"
                                IsHitTestVisible="False" 
                                Content="{TemplateBinding SelectionBoxItem}"
                                ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                Margin="3,1,23,1"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Left"
                                TextElement.Foreground="{TemplateBinding Foreground}"/>
                            <TextBox 
                                x:Name="PART_EditableTextBox"
                                Style="{x:Null}" 
                                Template="{StaticResource ComboBoxTextBox}" 
                                HorizontalAlignment="Left" 
                                VerticalAlignment="Center" 
                                Margin="3,1,23,1"
                                Focusable="True" 
                                Background="Transparent"
                                Visibility="Hidden"
                                Foreground="{TemplateBinding Foreground}"
                                IsReadOnly="{TemplateBinding IsReadOnly}"/>
                            <Popup 
                                Name="Popup"
                                Placement="Bottom"
                                IsOpen="{TemplateBinding IsDropDownOpen}"
                                AllowsTransparency="True" 
                                Focusable="False"
                                PopupAnimation="Fade" 
                                HorizontalOffset="-1">
                                <Grid 
                                    Name="DropDown"
                                    SnapsToDevicePixels="True"                
                                    MinWidth="{TemplateBinding ActualWidth}"
                                    MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                    <Border 
                                        x:Name="DropDownBorder"
                                        Background="Black"
                                        BorderThickness="1"
                                        BorderBrush="{TemplateBinding Foreground}"
                                        TextElement.Foreground="{TemplateBinding Foreground}"
                                        TextElement.FontFamily="Segoe UI">
                                        <ScrollViewer 
                                            Margin="2,4" 
                                            SnapsToDevicePixels="True"
                                            Background="{Binding ElementName=DropDownBorder, Path=Background}">
                                            <VirtualizingStackPanel 
                                            IsItemsHost="True" 
                                            KeyboardNavigation.DirectionalNavigation="Contained" />
                                        </ScrollViewer>
                                    </Border>
                                </Grid>
                            </Popup>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter TargetName="ToggleButton" Property="Background" Value="#E0E0E0"/>
                        </Trigger>
                        <Trigger Property="HasItems" Value="False">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="#888888"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
                        </Trigger>
                        <Trigger Property="IsEditable" Value="True">
                            <Setter Property="IsTabStop" Value="False"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility"	Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- SimpleStyles: ComboBoxItem -->
    <Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border 
                        Name="Border"
                        Padding="2"
                        SnapsToDevicePixels="True"
                        CornerRadius="0">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="#333"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="#FFF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- SimpleStyles: ScrollViewer -->
    <!--<Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <ControlTemplate.Resources>
                        <sys:Double x:Key="GradSize">10</sys:Double>
                    </ControlTemplate.Resources>
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter Name="PART_ScrollContentPresenter" Grid.Column="0" Grid.Row="0"/>

                        <Rectangle 
                            x:Name="_LeftGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Width="{StaticResource ResourceKey=GradSize}" 
                            HorizontalAlignment="Left"
                            IsHitTestVisible="False"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="{TemplateBinding Background}" Offset="0.25" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle 
                            x:Name="_RightGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Width="{StaticResource ResourceKey=GradSize}" 
                            HorizontalAlignment="Right"
                            IsHitTestVisible="False"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="#00000000" Offset="0.25" />
                                    <GradientStop Color="{TemplateBinding Background}" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle
                            x:Name="_TopGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Height="{StaticResource ResourceKey=GradSize}" 
                            VerticalAlignment="Top"
                            IsHitTestVisible="False"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="{TemplateBinding Background}" Offset="0.25" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle 
                            x:Name="_BottomGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Height="{StaticResource ResourceKey=GradSize}" 
                            VerticalAlignment="Bottom"
                            IsHitTestVisible="False"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#00000000" Offset="0.25" />
                                    <GradientStop Color="{TemplateBinding Background}" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>

                        <ScrollBar Name="PART_VerticalScrollBar"
                            Orientation="Vertical"
                            Grid.Row="0"
                            Grid.Column="1"
                            Value="{TemplateBinding VerticalOffset}"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                        <ScrollBar Name="PART_HorizontalScrollBar"
                            Orientation="Horizontal"
                            Grid.Row="1"
                            Grid.Column="0"
                            Value="{TemplateBinding HorizontalOffset}"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>-->
    <Style TargetType="{x:Type ScrollViewer}" x:Key="MetroScrollViewer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <ControlTemplate.Resources>
                        <sys:Double x:Key="GradSize">10</sys:Double>
                    </ControlTemplate.Resources>
                    <Grid Background="{TemplateBinding Background}">
                        <ScrollContentPresenter Name="PART_ScrollContentPresenter"/>

                        <Rectangle 
                            x:Name="_LeftGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Width="{StaticResource ResourceKey=GradSize}" 
                            HorizontalAlignment="Left"
                            IsHitTestVisible="False"
                            Visibility="{Binding ComputedHorizontalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="{TemplateBinding Background}" Offset="0.25" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle 
                            x:Name="_RightGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Width="{StaticResource ResourceKey=GradSize}" 
                            HorizontalAlignment="Right"
                            IsHitTestVisible="False"
                            Visibility="{Binding ComputedHorizontalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="#00000000" Offset="0.25" />
                                    <GradientStop Color="{TemplateBinding Background}" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle
                            x:Name="_TopGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Height="{StaticResource ResourceKey=GradSize}" 
                            VerticalAlignment="Top"
                            IsHitTestVisible="False"
                            Visibility="{Binding ComputedVerticalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="{TemplateBinding Background}" Offset="0.25" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle 
                            x:Name="_BottomGrad"
                            Grid.ZIndex="1" 
                            Margin="0" 
                            Height="{StaticResource ResourceKey=GradSize}" 
                            VerticalAlignment="Bottom"
                            IsHitTestVisible="False"
                            Visibility="{Binding ComputedVerticalScrollBarVisibility}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#00000000" Offset="0.25" />
                                    <GradientStop Color="{TemplateBinding Background}" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>

                        <ScrollBar 
                            Name="PART_VerticalScrollBar"
                            Orientation="Vertical"
                            
                            HorizontalAlignment="Right"
                            
                            Value="{TemplateBinding VerticalOffset}"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                        <ScrollBar 
                            Name="PART_HorizontalScrollBar"
                            Orientation="Horizontal"
                            
                            VerticalAlignment="Bottom"
                            
                            Value="{TemplateBinding HorizontalOffset}"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ComputedVerticalScrollBarVisibility" Value="Visible">
                            <Setter TargetName="PART_HorizontalScrollBar" Property="Margin" Value="0,0,16,0"/>
                        </Trigger>
                        <Trigger Property="ComputedHorizontalScrollBarVisibility" Value="Visible">
                            <Setter TargetName="PART_VerticalScrollBar" Property="Margin" Value="0,0,0,16"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- MetroStyles: TabItem -->
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border
                        x:Name="ContentBorder"
                        Cursor="Hand"
                        Background="#00000000"
                        TextBlock.Foreground="#777"
                        TextBlock.FontFamily="Segoe UI"
                        TextBlock.FontSize="18"
                        TextBlock.TextAlignment="Center">
                        <ContentPresenter 
                            x:Name="ContentSite"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Center"
                            ContentSource="Header"
                            Margin="12,7,12,2"
                            RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Panel.ZIndex" Value="99" />
                            <Setter TargetName="ContentBorder" Property="TextBlock.Foreground" Value="#AAA" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter TargetName="ContentBorder" Property="TextBlock.Foreground" Value="#FFF" />
                            <Setter Property="BorderBrush" Value="Black" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="#888888" />
                            <Setter TargetName="ContentBorder" Property="TextBlock.Foreground" Value="#555" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- SimpleStyles: Slider -->
    <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Ellipse 
                        Name="Ellipse" 
                        Fill="#C0C0C0"
                        Stroke="#404040"
                        StrokeThickness="1" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Ellipse" Property="Fill" Value="#808080"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Ellipse" Property="Fill" Value="#EEEEEE"/>
                        </Trigger>
                        <Trigger Property="IsMouseCaptureWithin" Value="True">
                            <Setter TargetName="Ellipse" Property="Fill">
                                <Setter.Value>
                                    <RadialGradientBrush>
                                        <GradientStop Color="#C0C0C0" Offset="0"/>
                                        <GradientStop Color="#808080" Offset="1"/>
                                    </RadialGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto" MinHeight="{TemplateBinding Slider.MinHeight}"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="10.5"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="10.5"/>
            </Grid.ColumnDefinitions>
            <TickBar 
                Name="TopTick"
                SnapsToDevicePixels="True" 
                Placement="Top"
                Fill="#404040"
                Height="4"
                Visibility="Collapsed"
                Grid.ColumnSpan="3"/>
            <Border 
                Name="TrackBackground"
                Margin="0"
                CornerRadius="2" 
                Height="4"
                Grid.Row="1"
                Background="#E0E0E0" 
                BorderBrush="#404040"
                BorderThickness="1"
                Grid.Column="1"/>
            <Track Grid.Row="1" Name="PART_Track" Grid.ColumnSpan="3">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
            Style="{StaticResource SliderButtonStyle}"
            Command="Slider.DecreaseLarge" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource SliderThumbStyle}" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
            Style="{StaticResource SliderButtonStyle}"
            Command="Slider.IncreaseLarge" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar 
        Name="BottomTick"
        SnapsToDevicePixels="True" 
        Grid.Row="2"
        Fill="{TemplateBinding Foreground}"
        Placement="Bottom"
        Height="4"
        Visibility="Collapsed" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="TickPlacement" Value="TopLeft">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="TickPlacement" Value="BottomRight">
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="TickPlacement" Value="Both">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="VerticalSlider" TargetType="{x:Type Slider}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding Slider.MinWidth}"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TickBar 
        Name="TopTick"
        SnapsToDevicePixels="True" 
        Placement="Left"
        Fill="#404040"
        Width="4"
        Visibility="Collapsed" />
            <Border 
        Name="TrackBackground"
        Margin="0"
        CornerRadius="2" 
        Width="4"
        Grid.Column="1"
        Background="#E0E0E0" 
        BorderBrush="#404040"
        BorderThickness="1" />
            <Track Grid.Column="1" Name="PART_Track">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
            Style="{StaticResource SliderButtonStyle}"
            Command="Slider.DecreaseLarge" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource SliderThumbStyle}" Height="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
            Style="{StaticResource SliderButtonStyle}"
            Command="Slider.IncreaseLarge" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar 
        Name="BottomTick"
        SnapsToDevicePixels="True" 
        Grid.Column="2"
        Fill="{TemplateBinding Foreground}"
        Placement="Right"
        Width="4"
        Visibility="Collapsed" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="TickPlacement" Value="TopLeft">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="TickPlacement" Value="BottomRight">
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="TickPlacement" Value="Both">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type Slider}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinWidth" Value="104" />
                <Setter Property="MinHeight" Value="21" />
                <Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="MinWidth" Value="21" />
                <Setter Property="MinHeight" Value="104" />
                <Setter Property="Template" Value="{StaticResource VerticalSlider}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="{x:Type brightness:BrightnessControl}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinWidth" Value="104" />
                <Setter Property="MinHeight" Value="21" />
                <Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="MinWidth" Value="21" />
                <Setter Property="MinHeight" Value="104" />
                <Setter Property="Template" Value="{StaticResource VerticalSlider}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>